var submitImgObj = {
    el: '#pageApp',
    data: {
      albumTitle:'',
      imgList:[],
      uploadImgList:[],
    },
    components:{
     
    },
    methods: {
      getSignature:function(){
       var _this = this;
       g.ajax({
         type: 'GET',
         url: g.url.format('/qcloud/getSignature'),
         success: function (result) {
            console.log(result);
         }
       });
      },
      uploadImg:function(path){
        var _this = this;
        $.imgUpload({
          progressCallBack:function (curr) {
        
          },
          successCallback:function(path){
            console.log(path);
            _this.uploadImgList.push(path);
            _this.imgList.push(g.url.imgFormat(path));
          },
          cropper:true,
          cropperOpts: {
            aspectRatio: 1 / 1,
            preview:$('.cropper-preview'),
            zoomable:false, 
            viewMode:1, 
          }
        },cos);
      },
      submitShare:function(){
        if(!this.checkForm()){
          return
        };
        var data = {} , _this = this;
        data.title = this.albumTitle;
        data.imgs = this.uploadImgList.join(',');
        g.modal.waiting({title:"上传中",icon:'icon-jiazaizhong-copy',wait:true});
        g.ajax({
          type: 'POST',
          url: g.url.format('/api/author/addAlbum'),
          data:data,
          success: function (result) {
              g.window.openNew(g.url.urlHref('/page/beautyImg.html'));
          }
        });
      },
      checkForm:function(){
        if(!this.albumTitle){
          g.modal.tip({title:'美图标题不能为空！'})
          return false;
        }
        if(this.uploadImgList.length == 0){
          g.modal.tip({title:'您还没有选择要发布的美图哦！'})
          return false;
        }
        return true;
      }
    },
    mounted:function () {
      // this.getSignature();
    }
};
var initPage = function(){
  new Vue(submitImgObj);
};